Pain dummy

Pain :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0026.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0026.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 12379788 bytes Loading image number: 31 Elapsed time is 66.853624 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 3035922 Bit rate: 21.53 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C',...
'stim_P', 'stim_V', 'stim_C',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C',...
'stimXint_P', 'stimXint_V', 'stimXint_C',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C','simple_cue_G',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C','simple_cueXcue_G', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C','simple_stim_G',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C','simple_stimXcue_G',...
'simple_stimXint_P', 'simple_stimXint_V','simple_stimXint_C', 'simple_stimXint_G'};

Pain :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 23:59:35 - 09/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Pain :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 5 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 22.58% Expected 1.55 outside 95% ellipsoid, found 4 Potential outliers based on mahalanobis distance: Bonferroni corrected: 4 images Cases 8 14 16 18 Uncorrected: 4 images Cases 8 14 16 18 Retained 11 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 48.39% Expected 1.55 outside 95% ellipsoid, found 1 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 1 images Cases 5 Mahalanobis (cov and corr, q<0.05 corrected): 4 images Outlier_count Percentage _____________ __________ global_mean 1 3.2258 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 3.2258 mahal_cov_uncor 4 12.903 mahal_cov_corrected 4 12.903 mahal_corr_uncor 1 3.2258 mahal_corr_corrected 0 0 Overall_uncorrected 5 16.129 Overall_corrected 4 12.903
SPM12: spm_check_registration (v7759) 00:00:01 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 31×1 logical array
0 0 0 0 1 0 0 1 0 0
wh_outlier_corr = 31×1 logical array
0 0 0 0 0 0 0 1 0 0

Pain :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Pain :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 31
%for s = 1:length(wh_outlier_corr)
%disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×27 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [27×12 char] fullpath: [31×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×27 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [27×12 char] fullpath: [27×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×27 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [27×12 char] fullpath: [27×118 char] files_exist: [27×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0026.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 4 participants, size is now 27

Pain :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Pain :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 00:00:09 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.025524 Image 1 37 contig. clusters, sizes 1 to 50627 Positive effect: 50742 voxels, min p-value: 0.00000000 Negative effect: 234 voxels, min p-value: 0.00001454
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 00:00:11 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×37 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 1293 voxels displayed, 49683 not displayed on these slices
sagittal montage: 1271 voxels displayed, 49705 not displayed on these slices
sagittal montage: 1181 voxels displayed, 49795 not displayed on these slices
axial montage: 9039 voxels displayed, 41937 not displayed on these slices
axial montage: 9549 voxels displayed, 41427 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Vicarious dummy

clear all

Vicarious :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0027.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0027.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 12379788 bytes Loading image number: 31 Elapsed time is 89.015915 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 3041112 Bit rate: 21.54 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C',...
'stim_P', 'stim_V', 'stim_C',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C',...
'stimXint_P', 'stimXint_V', 'stimXint_C',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C','simple_cue_G',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C','simple_cueXcue_G', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C','simple_stim_G',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C','simple_stimXcue_G',...
'simple_stimXint_P', 'simple_stimXint_V','simple_stimXint_C', 'simple_stimXint_G'};

Vicarious :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 00:02:19 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Vicarious :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 3 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 32.26% Expected 1.55 outside 95% ellipsoid, found 4 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 7 Uncorrected: 4 images Cases 7 8 13 18 Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 41.94% Expected 1.55 outside 95% ellipsoid, found 1 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 1 images Cases 29 Mahalanobis (cov and corr, q<0.05 corrected): 1 images Outlier_count Percentage _____________ __________ global_mean 1 3.2258 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 3.2258 mahal_cov_uncor 4 12.903 mahal_cov_corrected 1 3.2258 mahal_corr_uncor 1 3.2258 mahal_corr_corrected 0 0 Overall_uncorrected 5 16.129 Overall_corrected 1 3.2258
SPM12: spm_check_registration (v7759) 00:02:42 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 31×1 logical array
0 0 0 0 0 0 1 1 0 0
wh_outlier_corr = 31×1 logical array
0 0 0 0 0 0 1 0 0 0

Vicarious :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Vicarious :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 31
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×30 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [30×12 char] fullpath: [31×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0027.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×30 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [30×12 char] fullpath: [30×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0027.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×30 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [30×12 char] fullpath: [30×118 char] files_exist: [30×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0027.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 1 participants, size is now 30

Vicarious :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Vicarious :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 00:02:48 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.000177 Image 1 20 contig. clusters, sizes 1 to 176 Positive effect: 92 voxels, min p-value: 0.00000882 Negative effect: 263 voxels, min p-value: 0.00000000
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 00:02:50 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×20 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 1 voxels displayed, 354 not displayed on these slices
sagittal montage: 0 voxels displayed, 355 not displayed on these slices sagittal montage: 4 voxels displayed, 351 not displayed on these slices
axial montage: 92 voxels displayed, 263 not displayed on these slices
axial montage: 70 voxels displayed, 285 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Cognitive dummy

Cognitive :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0028.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0028.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 12379788 bytes Loading image number: 31 Elapsed time is 65.737853 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 3039045 Bit rate: 21.54 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C',...
'stim_P', 'stim_V', 'stim_C',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C',...
'stimXint_P', 'stimXint_V', 'stimXint_C',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C','simple_cue_G',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C','simple_cueXcue_G', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C','simple_stim_G',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C','simple_stimXcue_G',...
'simple_stimXint_P', 'simple_stimXint_V','simple_stimXint_C', 'simple_stimXint_G'};

Cognitive :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 00:04:41 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Cognitive :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 4 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 25.81% Expected 1.55 outside 95% ellipsoid, found 4 Potential outliers based on mahalanobis distance: Bonferroni corrected: 2 images Cases 7 18 Uncorrected: 4 images Cases 2 7 18 20 Retained 10 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 48.39% Expected 1.55 outside 95% ellipsoid, found 0 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 0 images Cases Mahalanobis (cov and corr, q<0.05 corrected): 2 images Outlier_count Percentage _____________ __________ global_mean 2 6.4516 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 3.2258 mahal_cov_uncor 4 12.903 mahal_cov_corrected 2 6.4516 mahal_corr_uncor 0 0 mahal_corr_corrected 0 0 Overall_uncorrected 4 12.903 Overall_corrected 2 6.4516
SPM12: spm_check_registration (v7759) 00:05:00 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 31×1 logical array
0 1 0 0 0 0 1 0 0 0
wh_outlier_corr = 31×1 logical array
0 0 0 0 0 0 1 0 0 0

Cognitive :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Cognitive :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 31
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [31×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0028.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [29×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0028.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [29×118 char] files_exist: [29×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0028.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 2 participants, size is now 29

Cognitive:: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Cognitive :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 00:05:05 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.000490 Image 1 72 contig. clusters, sizes 1 to 202 Positive effect: 32 voxels, min p-value: 0.00007653 Negative effect: 945 voxels, min p-value: 0.00000012
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 00:05:07 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×72 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 18 voxels displayed, 959 not displayed on these slices
sagittal montage: 5 voxels displayed, 972 not displayed on these slices
sagittal montage: 13 voxels displayed, 964 not displayed on these slices
axial montage: 230 voxels displayed, 747 not displayed on these slices
axial montage: 220 voxels displayed, 757 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

General dummy

General :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0029.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0029.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 12379788 bytes Loading image number: 31 Elapsed time is 65.734191 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 3042028 Bit rate: 21.54 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C',...
'stim_P', 'stim_V', 'stim_C',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C',...
'stimXint_P', 'stimXint_V', 'stimXint_C',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C','simple_cue_G',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C','simple_cueXcue_G', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C','simple_stim_G',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C','simple_stimXcue_G',...
'simple_stimXint_P', 'simple_stimXint_V','simple_stimXint_C', 'simple_stimXint_G'};

General :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 00:06:47 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

General :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 4 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 22.58% Expected 1.55 outside 95% ellipsoid, found 5 Potential outliers based on mahalanobis distance: Bonferroni corrected: 2 images Cases 16 18 Uncorrected: 5 images Cases 7 8 14 16 18 Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 51.61% Expected 1.55 outside 95% ellipsoid, found 0 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 0 images Cases Mahalanobis (cov and corr, q<0.05 corrected): 2 images Outlier_count Percentage _____________ __________ global_mean 2 6.4516 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 1 3.2258 mahal_cov_uncor 5 16.129 mahal_cov_corrected 2 6.4516 mahal_corr_uncor 0 0 mahal_corr_corrected 0 0 Overall_uncorrected 5 16.129 Overall_corrected 2 6.4516
SPM12: spm_check_registration (v7759) 00:07:07 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 31×1 logical array
0 0 0 0 0 0 1 1 0 0
wh_outlier_corr = 31×1 logical array
0 0 0 0 0 0 0 0 0 0

General :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

General :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 31
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [31×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0029.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [29×118 char] files_exist: [31×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0029.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×29 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [29×12 char] fullpath: [29×118 char] files_exist: [29×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-03_CEScsA_24dofcsd/1stLevel/sub-0008/con_0029.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 2 participants, size is now 29

General:: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

General :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 00:07:12 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.007810 Image 1 85 contig. clusters, sizes 1 to 5951 Positive effect: 15500 voxels, min p-value: 0.00000000 Negative effect: 93 voxels, min p-value: 0.00017703
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 00:07:13 - 10/06/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×85 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 542 voxels displayed, 15051 not displayed on these slices
sagittal montage: 572 voxels displayed, 15021 not displayed on these slices
sagittal montage: 546 voxels displayed, 15047 not displayed on these slices
axial montage: 2339 voxels displayed, 13254 not displayed on these slices
axial montage: 2506 voxels displayed, 13087 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;